import QtQuick 1.1
import com.nokia.symbian 1.1
import QtWebKit 1.0

Page {
    id: mainPage
    function disable(){
        info_date.visible = false;
        sms.visible = false;
        sms_hors.visible = false;
        data.visible = false;
        data_hors.visible = false;
        voix_conso.visible = false;
        voix_hors.visible = false;
    }

//    tools: ToolBarLayout {
//    ToolButton {
//    iconSource: "toolbar-back"
//    onClicked: Qt.quit();
//        }
//    ButtonRow{
//        checkedButton: local
//        Button{
//            id: local
//            text : "France"
//            onClicked: flipable.flipped = !flipable.flipped
//        }
//        Button{
//            id: internatinal
//            text: "Etranger"
//            onClicked: flipable.flipped = !flipable.flipped
//        }
//        }
//    }

    Button{
        id: button
        x: 68
        y: 520
        width: 224
        height: 42
        anchors.horizontalCenterOffset: 0
        anchors.verticalCenterOffset: 221
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        onClicked:
        {
            m_downData.split_data(web_view1.html);
            titulaire.text = m_downData.getProprietaire();
            info_date.text = m_downData.getLigneDetail();

            voix_conso.text = "Vous avez consommer : " + m_downData.getVoixConso();
            voix_hors.text = m_downData.getVoixHors();
            voix_int.text = "Voix International : " + m_downData.getVoixInt();
            sms.text = "Nombre SMS utiliser : " + m_downData.getSms();
            sms_hors.text = "Nombre SMS HorsForfait " + m_downData.getSmsHors();
            mms.text = "Nombre MMS utiliser : " + m_downData.getMMS();
            mms_hors.text = "Nombre MMS HorsForfait : " + m_downData.getMMSHors();
            data.text = "Data Utiliser : " + m_downData.getData();
            data_hors.text = "Data HorsForfait : " + m_downData.getDataHors();


        }

    }
       WebView {
            id: web_view1
            height: 10
            width: 10
            visible: false
            url: "free.html"
        }

       Flipable {
            id: flipable

            property bool flipped: false
            anchors.bottomMargin: 150
            anchors.fill: parent
/********************* FRANCE ************************/
            front:
            Text {
                id: titulaire
                color: "#ffffff"
                text: qsTr("Titulaire de la ligne")
                anchors.horizontalCenter: parent.horizontalCenter
                font.pointSize: 10
                anchors.top: parent.top
                anchors.topMargin: 20
                Text {
                    id: info_date
                    color: "#ffffff"
                    text: qsTr("Info Date")
                    anchors.left: parent.left
                    anchors.leftMargin: -50
                    font.pointSize: 8
                    anchors.top: titulaire.bottom
                    anchors.topMargin: 20
                    }

                Text {
                    id: voix_conso
                    width: 50
                    color: "#ffffff"
                    text: "Voix conso"
                    anchors.left: parent.left
                    anchors.leftMargin: -50
                    font.pointSize: 8
                    anchors.top: info_date.bottom
                    anchors.topMargin: 5
                }
                Text {
                    id: voix_hors
                    width: 29
                    height: 17
                    color: "#ffffff"
                    text: "voix hors"
                    anchors.left: parent.left
                    anchors.leftMargin: -20
                    anchors.top: voix_conso.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                }
                Text {
                    id: sms
                    text: qsTr("text")
                     color: "#ffffff"
                     anchors.top: voix_hors.bottom
                     anchors.topMargin: 5
                     anchors.left: parent.left
                     anchors.leftMargin: -50
                     font.pointSize: 8
                }

                Text {
                    id: sms_hors
                    text: qsTr("text")
                    anchors.left: parent.left
                    anchors.leftMargin: -20
                     color: "#ffffff"
                     anchors.top: sms.bottom
                     anchors.topMargin: 5
                     font.pointSize: 8
                }
                Text {
                    id: mms
                    text: qsTr("text")
                    color: "#ffffff"
                    anchors.top: sms_hors.bottom
                    anchors.topMargin: 5
                    anchors.left: parent.left
                    anchors.leftMargin: -50
                    font.pointSize: 8
                }
                Text {
                    id: mms_hors
                    width: 50
                     color: "#ffffff"
                     anchors.top: mms.bottom
                     anchors.topMargin: 5
                     anchors.left: parent.left
                     anchors.leftMargin: -20
                     font.pointSize: 8
                }
                Text {
                    id: data
                    text: qsTr("text")
                     color: "#ffffff"
                     anchors.top: mms_hors.bottom
                     anchors.topMargin: 5
                     anchors.left: parent.left
                     anchors.leftMargin: -50
                     font.pointSize: 8
                }
                Text {
                    id: data_hors
                    x: 0
                    text: qsTr("text")
                    color: "#ffffff"
                    anchors.top: data.bottom
                    anchors.topMargin: 5
                    anchors.left: parent.left
                    anchors.leftMargin: -20
                    font.pointSize: 8
                }

                Rectangle {
                    id: rectangle1
                    y: 181
                    height: 3
                    color: "#ffffff"
                    anchors.verticalCenterOffset: 20
                    anchors.right: parent.right
                    anchors.rightMargin: -100
                    anchors.left: parent.left
                    anchors.leftMargin: -100
                    anchors.verticalCenter: parent.verticalCenter
                }

        } //Fin text
            /******************** Etranger *****************/
            back:
             Text {
                id: voix_int
                width: 65
                height: 13
                text: qsTr("text")
                anchors.left: titulaire.right
                anchors.leftMargin: 0
                anchors.top: titulaire.bottom
                anchors.topMargin: 0

                font.pointSize: 8
                color: "#ffffff"
                Text {
                    id: voix_intHors
                    text: qsTr("Voix Int HORS")
                    anchors.top: parent.top
                    anchors.topMargin: 20
                    font.pointSize: 8
                    color: "#ffffff"
                    }
                Text {
                    id: voix_intSpec
                    text: qsTr("Voix Int SPEC")
                    anchors.top: voix_intHors.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"
                    }
                Text {
                    id: sms_int
                    text: qsTr("SMS Int")
                    anchors.top: voix_intSpec.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"
                    }
                Text {
                    id: sms_intHors
                    text: qsTr("SMS int Hors")
                    anchors.top: sms_int.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"

                    }
                Text {
                    id: mms_int
                    text: qsTr("MMS Int")
                    anchors.top: sms_intHors.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"

                    }
                Text {
                    id: mms_intHors
                    text: qsTr("MMS Int Hors")
                    anchors.top: mms_int.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"

                    }
                Text {
                    id: data_int
                    text: qsTr("Data INT")
                    anchors.top: mms_intHors.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"

                    }
                Text {
                    id: data_intHors
                    text: qsTr("Data int HORS")
                    anchors.top: data_int.bottom
                    anchors.topMargin: 5
                    font.pointSize: 8
                    color: "#ffffff"

                    }
                }

            transform: Rotation {
                id: rotation
                origin.x: flipable.width/2
                origin.y: flipable.height/2
                axis.x: 0; axis.y: 1; axis.z: 0     // set axis.y to 1 to rotate around y-axis
                angle: 0    // the default angle
            }

            states: State {
                name: "back"
                PropertyChanges { target: rotation; angle: 180 }
                when: flipable.flipped
            }

            transitions: Transition {
                NumberAnimation { target: rotation; property: "angle"; duration: 500 }
            }

            MouseArea {
                anchors.fill: parent
                onClicked: {
                    flipable.flipped = !flipable.flipped
                   // disable();
                }
            }

        }




}
